package com.example.myapplication.retrofit;

import android.content.SharedPreferences;


import com.example.myapplication.base.BaseApplication;

import java.io.IOException;
import java.util.HashSet;

import okhttp3.Interceptor;

public class ReceivedCookiesInterceptor implements Interceptor {

    @Override
    public okhttp3.Response intercept(Chain chain) throws IOException {
        okhttp3.Response originalResponse = chain.proceed(chain.request());
//        if (!originalResponse.headers("Set-Cookie").isEmpty()) {
//            HashSet<String> cookies = new HashSet<>();
//            for (String header : originalResponse.headers("Set-Cookie")) {
//                cookies.add(header);
//            }
//            SharedPreferences.Editor config = BaseApplication.getInstance().getSharedPreferences("config", BaseApplication.getInstance().MODE_PRIVATE).edit();
//            config.putStringSet("cookie", cookies);
//            config.commit();
//        }
        return originalResponse;
    }
}


